Total Complexity | 2 |
Total Lines | 32 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import { BEditaApiClient, BEditaClientResponse } from '../bedita-api-client'; |
||
24 | |||
25 | /** |
||
26 | * Base class to implement response interceptors. |
||
27 | */ |
||
28 | export default abstract class ResponseInterceptor implements ResponseInterceptorInterface { |
||
29 | |||
30 | /** |
||
31 | * Keep the BEditaApiClient instance. |
||
32 | */ |
||
33 | protected beditaClient: BEditaApiClient; |
||
34 | |||
35 | /** |
||
36 | * Constructor. |
||
37 | * |
||
38 | * @param beditaClient The bedita api client |
||
39 | */ |
||
40 | constructor(beditaClient: BEditaApiClient) { |
||
41 | this.beditaClient = beditaClient; |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * @inheritdoc |
||
46 | */ |
||
47 | public responseHandler(response: AxiosResponse): Promise<BEditaClientResponse<any> | AxiosResponse<any>> { |
||
48 | return Promise.resolve(response); |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * @inheritdoc |
||
53 | */ |
||
54 | public errorHandler(error: any): Promise<any> { |
||
55 | return Promise.reject(error); |
||
56 | } |
||
58 |